/* -----------------------------------------------------------------------
 * Card Test 3 = Testing Village card
 * Using provided template for testUpdateCoins.c
 *
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
#include <stdlib.h>

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

void testVillage() {
    //Game setup
    int seed = 1000;
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    initializeGame(numPlayer, k, seed, &G);

    //Card effect setup
    int card = village;
    int choice1 = 0;
    int choice2 = 0;
    int choice3 = 0; 
    int handPos = 1;
    //Bonus setup, irrelevant to test
    int b = 0;
    int *bonus;
    bonus = &b;
    

    
    printf ("TESTING playing 'village':\n");

    int initHand = G.handCount[0];
    int initActions = G.numActions;
#if (NOISY_TEST == 1)
    printf("Test player %d prior to playing village has %d hand card(s) and %d actions. %d cards/%d actions expected.\n", 0, G.handCount[0], G.numActions, initHand, initActions);
#endif
    assert(G.handCount[0] == initHand);
    assert(G.numActions == initActions);
    //Play village card
     cardEffect(card, choice1, choice2, choice3, &G, handPos, bonus);

#if (NOISY_TEST == 1)
    
    printf("Test player %d after playing village has %d hand card(s) and %d actions. %d cards/%d actions expected.\n", 0, G.handCount[0], G.numActions, initHand, initActions+2);
#endif
    assert(G.handCount[0] == initHand); //+1 add card, -1 play card
    assert(G.numActions == initActions + 2); //+2 actions added ***Card effect doesn't use an action***
    assert(G.playedCardCount == 1); //1 card should have been played

    printf("All tests passed!\n");
}



int main() {
    testVillage();
    return 0;
}
